package com.wlps.result;


public class ResultUtils {

    public static ResultVo vo(String msg, int code, Object data) {
        return new ResultVo(msg, code, data);
    }

    /**
     * @return
     */

    //无参返回值
    public static ResultVo success() {
        return vo(null, StatusCode.SUCCESS_CODE, null);

    }

    public static ResultVo success(String msg, Object data) {
        return vo(msg, StatusCode.SUCCESS_CODE, data);
    }

    //一个参数的返回值
    public static ResultVo success(String msg) {
        return vo(msg, StatusCode.SUCCESS_CODE, null);

    }

    //全部参数返回
    public static ResultVo success(String msg, int code, Object data) {
        return vo(null, StatusCode.SUCCESS_CODE, null);
    }

    public static ResultVo error() {
        return vo(null, StatusCode.ERROR_CODE, null);
    }

    public static ResultVo error(String str) {
        return vo(str, StatusCode.ERROR_CODE, null);
    }

    public static ResultVo error(String msg, int code) {
        return vo(msg, code, null);
    }

    public static ResultVo error(String msg, int code, Object data) {
        return vo(msg, code, data);
    }
    public static ResultVo error(ResultCode resultCode){
        return vo(resultCode.getMsg(),resultCode.getCode(),null);
    }
}
